<template>
	<view class="fui-wrap">
		 
	 
			<view class="fui-title">
				<fui-button @click="wxlogin()" :margin="['24rpx']" type="success">微信登录</fui-button>
				
			</view>
			
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
		 
			wxlogin(){
				
var that = this
				 uni.login({
				     provider: 'weixin',
				     success: function (loginRes) {
						 
						   uni.getUserInfo({
						       provider: 'weixin',
						       success: function(info) {
								   var userInfo =info.userInfo;
						          var obj={
						          		 loginCode:loginRes.code,
						          		 phoneCode:'',
						          		nickName:userInfo.nickName,
						          		 imageUrl:userInfo.avatarUrl
						          }
							      console.log(that.$request)
								  that.$request.post('wx/login', obj).then(res => {
								          console.log(res)
								  })
						       }
						   })
						   
						 
						    
						   
						
				     },
				     fail: function (err) {
				         // 登录授权失败
				         // err.code是错误码
				     }
				 });

			}
		}
	}
</script>

<style>

</style>
